package org.acra;

import android.content.Context;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import org.acra.b.c;

final class l
{
  private final Context a;

  l(Context paramContext)
  {
    this.a = paramContext;
  }

  private c a(Reader paramReader)
  {
    Object localObject2;
    int i;
    int j;
    c localc;
    int k;
    int m;
    int n;
    int i1;
    char c1;
    int i25;
    int i5;
    label188: int i6;
    int i4;
    label234: int i10;
    int i11;
    label268: int i7;
    label288: int i19;
    while (true)
    {
      BufferedReader localBufferedReader;
      int i2;
      try
      {
        localObject2 = new char[40];
        i = 0;
        j = -1;
        localc = new c();
        localBufferedReader = new BufferedReader(paramReader, 8192);
        k = 1;
        m = 0;
        n = 0;
        i1 = 0;
        i2 = localBufferedReader.read();
        if (i2 == -1)
        {
          if ((n != 2) || (i1 > 4))
            break label1088;
          throw new IllegalArgumentException("luni.08");
        }
      }
      finally
      {
      }
      c1 = (char)i2;
      if (i == localObject2.length)
      {
        char[] arrayOfChar = new char[2 * localObject2.length];
        System.arraycopy(localObject2, 0, arrayOfChar, 0, i);
        localObject2 = arrayOfChar;
      }
      if (n == 2)
      {
        int i3 = Character.digit(c1, 16);
        if (i3 >= 0)
        {
          i25 = i3 + (m << 4);
          i5 = i1 + 1;
          if (i5 >= 4)
            break;
          i1 = i5;
          m = i25;
          continue;
        }
        if (i1 > 4)
          break label517;
        throw new IllegalArgumentException("luni.09");
        i6 = i + 1;
        localObject2[i] = ((char)i4);
        if ((c1 == '\n') || (c1 == ''))
          break label528;
        i = i6;
        i1 = i5;
        m = i4;
        n = 0;
        continue;
        int i12 = i + 1;
        localObject2[i] = i10;
        i = i12;
        i1 = i5;
        m = i4;
        n = i11;
        k = 0;
        continue;
        if (!Character.isWhitespace(c1))
          break label1066;
        if (i7 != 3)
          break label812;
        i7 = 5;
        break label812;
        i19 = localBufferedReader.read();
        if (i19 != -1)
          break label857;
        int i22 = i5;
        m = i4;
        n = i7;
        i1 = i22;
        continue;
        label320: String str1 = new String((char[])localObject2, 0, i);
        localc.put(Enum.valueOf(ReportField.class, str1.substring(0, j)), str1.substring(j));
        break label955;
      }
    }
    while (true)
    {
      if (j >= 0)
      {
        String str2 = new String((char[])localObject2, 0, i);
        ReportField localReportField = (ReportField)Enum.valueOf(ReportField.class, str2.substring(0, j));
        String str3 = str2.substring(j);
        if (n == 1)
          str3 = str3 + "";
        localc.put(localReportField, str3);
      }
      return localc;
      label450: char c2 = c1;
      i11 = i7;
      i10 = c2;
      break label635;
      label465: int i9 = i5;
      m = i4;
      n = i7;
      i1 = i9;
      break;
      label484: int i15 = j;
      break label992;
      i4 = i25;
      break label188;
      int i26 = i1;
      i7 = n;
      i4 = m;
      i5 = i26;
      break label535;
      label517: i4 = m;
      i5 = i1;
      break label188;
      label528: i = i6;
      i7 = 0;
      label535: if (i7 == 1)
        switch (c1)
        {
        default:
          label624: char c3 = c1;
          i11 = 0;
          i10 = c3;
        case '\r':
        case '\n':
        case '':
        case 'b':
        case 'f':
        case 'n':
        case 'r':
        case 't':
        case 'u':
        }
      while (true)
      {
        label635: if (i11 != 4)
          break label234;
        j = i;
        i11 = 0;
        break label234;
        int i24 = i5;
        m = i4;
        n = 3;
        i1 = i24;
        break;
        int i23 = i5;
        m = i4;
        n = 5;
        i1 = i23;
        break;
        c1 = '\b';
        break label624;
        c1 = '\f';
        break label624;
        c1 = '\n';
        break label624;
        c1 = '\r';
        break label624;
        c1 = '\t';
        break label624;
        n = 2;
        i1 = 0;
        m = 0;
        break;
        switch (c1)
        {
        default:
          if ((i == 0) || (i == j))
            break label465;
          if (i7 == 5)
          {
            int i14 = i5;
            m = i4;
            n = i7;
            i1 = i14;
          }
          break;
        case '!':
        case '#':
          if (k == 0)
            break label268;
          break label288;
          int i20 = (char)i19;
          if ((i20 == 13) || (i20 == 10))
            break label465;
          if (i20 != 133)
            break label288;
          int i21 = i5;
          m = i4;
          n = i7;
          i1 = i21;
          break;
        case '\n':
          if (i7 == 3)
          {
            int i18 = i5;
            m = i4;
            n = 5;
            i1 = i18;
          }
          break;
        case '\r':
        case '':
          if ((i > 0) || ((i == 0) && (j == 0)))
          {
            if (j != -1)
              break label320;
            j = i;
            break label320;
          }
          j = -1;
          k = 1;
          int i17 = i5;
          m = i4;
          i1 = i17;
          i = 0;
          n = 0;
          break;
        case '\\':
          if (i7 != 4)
            break label484;
          i15 = i;
          j = i15;
          int i16 = i5;
          m = i4;
          n = 1;
          i1 = i16;
          break;
        case ':':
        case '=':
          label812: label857: label992: if (j != -1)
            break label268;
          label955: j = i;
          int i8 = i5;
          m = i4;
          i1 = i8;
          n = 0;
          break;
          if (j == -1)
          {
            int i13 = i5;
            m = i4;
            n = 4;
            i1 = i13;
            break;
          }
          label1066: if ((i7 != 5) && (i7 != 3))
            break label450;
          i10 = c1;
          i11 = 0;
        }
      }
      label1088: if ((j == -1) && (i > 0))
        j = i;
    }
  }

  private void a(StringBuilder paramStringBuilder, String paramString, boolean paramBoolean)
  {
    int i;
    if ((!paramBoolean) && (paramString.length() < 0) && (paramString.charAt(0) == ' '))
    {
      paramStringBuilder.append("\\ ");
      i = 1;
    }
    while (true)
    {
      if (i < paramString.length())
      {
        char c = paramString.charAt(i);
        switch (c)
        {
        case '\013':
        default:
          if (("\\#!=:".indexOf(c) >= 0) || ((paramBoolean) && (c == ' ')))
            paramStringBuilder.append('\\');
          if ((c >= ' ') && (c <= '~'))
            paramStringBuilder.append(c);
          break;
        case '\t':
        case '\n':
        case '\f':
        case '\r':
        }
        while (true)
        {
          i++;
          break;
          paramStringBuilder.append("\\t");
          continue;
          paramStringBuilder.append("\\n");
          continue;
          paramStringBuilder.append("\\f");
          continue;
          paramStringBuilder.append("\\r");
          continue;
          String str = Integer.toHexString(c);
          paramStringBuilder.append("\\u");
          for (int j = 0; j < 4 - str.length(); j++)
            paramStringBuilder.append("0");
          paramStringBuilder.append(str);
        }
      }
      return;
      i = 0;
    }
  }

  private boolean a(BufferedInputStream paramBufferedInputStream)
  {
    int i;
    do
    {
      i = (byte)paramBufferedInputStream.read();
      if ((i == -1) || (i == 35) || (i == 10) || (i == 61))
        return false;
    }
    while (i != 21);
    return true;
  }

  public c a(String paramString)
  {
    FileInputStream localFileInputStream = this.a.openFileInput(paramString);
    if (localFileInputStream == null)
      throw new IllegalArgumentException("Invalid crash report fileName : " + paramString);
    try
    {
      BufferedInputStream localBufferedInputStream = new BufferedInputStream(localFileInputStream, 8192);
      localBufferedInputStream.mark(2147483647);
      boolean bool = a(localBufferedInputStream);
      localBufferedInputStream.reset();
      if (!bool)
      {
        c localc1 = a(new InputStreamReader(localBufferedInputStream, "ISO8859-1"));
        return localc1;
      }
      c localc2 = a(new InputStreamReader(localBufferedInputStream));
      return localc2;
    }
    finally
    {
      localFileInputStream.close();
    }
  }

  public void a(c paramc, String paramString)
  {
    FileOutputStream localFileOutputStream = this.a.openFileOutput(paramString, 0);
    OutputStreamWriter localOutputStreamWriter;
    try
    {
      StringBuilder localStringBuilder = new StringBuilder(200);
      localOutputStreamWriter = new OutputStreamWriter(localFileOutputStream, "ISO8859_1");
      Iterator localIterator = paramc.entrySet().iterator();
      while (localIterator.hasNext())
      {
        Map.Entry localEntry = (Map.Entry)localIterator.next();
        a(localStringBuilder, ((ReportField)localEntry.getKey()).toString(), true);
        localStringBuilder.append('=');
        a(localStringBuilder, (String)localEntry.getValue(), false);
        localStringBuilder.append("\n");
        localOutputStreamWriter.write(localStringBuilder.toString());
        localStringBuilder.setLength(0);
      }
    }
    finally
    {
      localFileOutputStream.close();
    }
    localOutputStreamWriter.flush();
    localFileOutputStream.close();
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     org.acra.l
 * JD-Core Version:    0.6.2
 */